<?php
    $pager = $list['pager'];

    $page_url = parse_cur_url();
?>

<?php if ($pager->getTotalPage() > 1){ ?>
<div class="pagination">
    <ul>
        <?php if($pager->getCurrPage() > 1){?>
            <!--<li>
                <a href="<?php echo $page_url; ?><?php echo stristr($page_url, '.php?') ? '&' : '?';?><?php echo 'page=1';?>">
                    首页
                </a>
            </li>-->
        <?php }?>
        <?php if ($pager->hasPrePage()){ ?>
            <!--显示不可点样式 class disabled-->
            <li class="prev previous_page ">
                <a href="<?php echo $page_url;?><?php echo stristr($page_url, '.php?') ? '&' : '?';?><?php echo 'page=' . ($pager->getCurrPage() - 1); ?>">
                    上一页
                </a>
            </li>
        <?php } ?>
        <?php
        $near_pages = $pager->getNearerPages();
        foreach ($near_pages as $near_page){
        ?>
        <?php if ($pager->getCurrPage() == $near_page){ ?>
            <li class="active">
                <a href="###">
                    <?php echo $near_page?>
                </a>
            </li>
        <?php }else{ ?>
            <li>
                <a href="<?php echo $page_url; ?><?php echo stristr($page_url, '.php?') ? '&' : '?';?><?php echo 'page=' . $near_page; ?>">
                    <?php echo $near_page;?>
                </a>
            </li>
        <?php } ?>
        <?php } ?>
        <?php if ($pager->hasNextPage()): ?>
            <li class="next next_page ">
                <a href="<?php echo $page_url; ?><?php echo stristr($page_url, '.php?') ? '&' : '?';?><?php echo 'page=' . ($pager->getCurrPage() + 1); ?>">
                    下一页
                </a>
            </li>
        <?php endif;?>
        <?php if($pager->getTotalPage() > $near_page){?>
            <!--<li>
                <a href="<?php echo $page_url; ?><?php echo stristr($page_url, '.php?') ? '&' : '?';?><?php echo 'page=' . $pager->getTotalPage(); ?>">
                    尾页
                </a>
            </li>-->
        <?php }?>
            <!--<li>
                <a href="####">共<em><?php echo $pager->getTotalPage();?></em>页</a>
            </li>-->
            <li>
                <a href="javascript:void(0);" onclick="__pager_other__()"><span>跳转</span></a>
            </li>
            <li>
                <input type="text" id="_page_other" style="width: 23px;height:17px" value="<?php echo $pager->getCurrPage();?>" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
            </li>
    </ul>
</div>
<script>
    var __pager_other__ = function(){
        var p = Math.min(document.getElementById('_page_other').value*1,<?php echo $pager->getTotalPage();?>);
        var cp = <?php echo $pager->getCurrPage();?>;
        if(p != cp){
            location.href='<?php echo $page_url.(stristr($page_url, '.php?') ? '&' : '?');?>page='+p;
        }
    };
</script>
<?php } ?>